/**
 * 预处理
 **/
//路径计算
var $__ScriptPath='';
var $__ScriptElement= document.getElementsByTagName('script');
for (var i = 0, len = $__ScriptElement.length; i < len; i++)
{
    if ($__ScriptElement[i].src && $__ScriptElement[i].src.match(/import.js/)){
        $__ScriptPath=$__ScriptElement[i].src.substring(0,$__ScriptElement[i].src.lastIndexOf('/') + 1);
    }
}

//主题路径
var $__ThemesPath=$__ScriptPath.replace('scripts/','themes/');



/**
 * 导入程序
 **/
//辅助函数
function $__ImprotScript($path)
{
    document.write('<script type="text/javascript" src="'+($__ScriptPath+$path)+'"></script>');
}
function $__ImprotCSS($path)
{
    document.write('<link rel="stylesheet" type="text/css" href="'+($__ThemesPath+$path)+'" />');
}
function $__ImportTheme($theme)
{
    $__ImprotCSS('default/css/Core.css');
    $__ImprotCSS('default/css/Content.css');
    $__ImprotCSS('default/css/Window.css');
    $__ImprotCSS('default/css/Layout.css');
    $__ImprotCSS('default/css/Dock.css');
    $__ImprotCSS('default/css/Tabs.css');
}
function $__ImportMochauiScripts()
{
    $__ImprotScript('core/mootools-1.2.4-core-yc.js');
    $__ImprotScript('core/mootools-1.2.4-more-yc.js');
    $__ImprotScript('core/mocha.js');
    //如果是IE导入效果文件
    if(window.ActiveXObject){
        $__ImprotScript('core/excanvas_r43.js');
    }
}
//样式
$__ImportTheme();
//脚本
$__ImportMochauiScripts();



/**
 * 公共函数
 **/
//提示框
function malert($text,$width,$height,$second)
{
    if(parent)
        parent.MochaUI.notification_custom($text,$width,$height,$second);
    else
        MochaUI.notification_custom($text,$width,$height,$second);
}
//确认框
function mconfirm($text,$ok,$cancel)
{

    MUI.App.Confirm.Open(
    {
        text:$text,
        onOk:$ok||function(){},
        onCancel:$cancel||function(){}
    });
}


//应用函数封装
function mconfirm_delete($url)
{
    mconfirm
    (
        '确定要删除吗？',
        function(){
            window.location=$url;
        },
        function(){}
    );
}
